<?php
/**
 * class SearchesController
 *
 * @author: Monica
 *  
 */  
class SearchesController extends BaseController{

	
	public function bind(){
	
		$searches_ids = $this->SearchesSqlDAO-> queryAll("searchID");
		$searches = array();
		if (!empty($_POST['search']) || !empty($searches_ids)) {
			$searches = array_merge((array)$_POST['search'], (array)$searches_ids);
			$searches = array_filter(array_unique($searches));
	
		}
		return $searches;
	
	}
	
	/**
	 * Get Domain object by primry key
	 *
	 * @param String $id primary key
	 * @Return Searches 
	 */
	public function load($id){
		$this->set("search", $this->_model->load($id));
		
	}

	/**
	 * Get all records from table
	 */
	public function queryAll(){
		$this->set("searchList", $this->_model->queryAll());
	}
	
	/**
	 * Get all records from table ordered by field
	 * @Param $orderColumn column name
	 */
	public function queryAllOrderBy($orderColumn){
		
		$this->set("searchList", $this->_model->queryAllBy($orderColumn));
	}
	
	/**
 	 * Delete record from table
 	 * @param searche primary key
 	 */
	public function delete($searchID){
		return $this->_model->delete($searchID);
	}
	
	/**
 	 * Insert record to table
 	 *
 	 * @param Searches searche
 	 */
	public function insert($searchID){
		return $this->_model->insert($searchID);
		
	}
	
	/**
 	 * Update record in table
 	 *
 	 * @param Searches searche
 	 */
	public function update($searchID){
		return $this->_model->update($searchID);
		
		
	}	

	/**
	 * Delete all rows
	 */
	public function clean(){
		return $this->_model->clean();
		
	}
	public function queryByUserID($value){
		$this->set("searchesList", $this->_model->queryByUserID($value));
	}
	public function queryBySearchname($value){
		$this->set("searchesList", $this->_model->queryBySearchname($value));
		
		
	}

	public function queryBySearchfield($value){
		$this->set("searchesList", $this->_model->queryBySearchname($value));
	}
	

	public function queryBySearchvalue($value){
		$this->set("searchesList", $this->_model->queryBySearchname($value));
	}


	public function deleteByUserID($value){
		return $this->_model->deleteByUserID($value);
		
	}

	public function deleteBySearchname($value){
		return $this->_model->deleteBySearchname($value);
	}

	public function deleteBySearchfield($value){
		return $this->_model->deleteBySearchfield($value);
		
	}

	public function deleteBySearchvalue($value){
		return $this->_model->deleteBySearchvalue($value);
	}


}
?>